package demo4;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Person {
    @Autowired   //自动装配  用于定义在属性上告知Spring
    @Qualifier("summer")
    //private  Shirt   shirt;
    //private Sweater sweater;
    private  Clothes clothes = new Sweater();  //前父后子  //面向接口  人需要衣服，不是具体的某个衣服
     @Override
    public String toString() {
        return "Person{" +
                "clothes=" + clothes +
                '}';
    }
}
